package com.wang.Demo;

import java.io.IOException;
import java.util.Enumeration;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Demo01 extends HttpServlet {
	@Override
	public void init() throws ServletException {
		String value =this.getInitParameter("name");
		System.out.println(value);
	}
	
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		Enumeration<String> names =this.getInitParameterNames();
		while (names.hasMoreElements()) {
			String key = names.nextElement();
			String value = this.getInitParameter(key);
			System.out.println(key+"\t"+ value);
		}
	}

	@Override
	public void destroy() {
		System.out.println("bye~");
	}

}
